package com.jianguozh.difs.common.exception;

import com.jianguozh.difs.common.bean.IErrorCode;

/**
 * 基础异常
 *
 * @author hanrs
 * @email 4076130@qq.com
 * @since 2022/3/9 14:17
 */
public class DifsException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * 错误码对象
     */
    private IErrorCode errorCode;


    public DifsException() {
        super();
    }

    public DifsException(String message) {
        super(message);
    }

    public DifsException(IErrorCode errorCode) {
        this(errorCode.getMsg());
        this.errorCode = errorCode;
    }

    public DifsException(IErrorCode errorCode, String message) {
        this(message);
        this.errorCode = errorCode;
    }

    public DifsException(String message, Throwable cause) {
        super(message, cause);
    }

    public DifsException(Throwable cause) {
        super(cause);
    }

    protected DifsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public IErrorCode getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(IErrorCode errorCode) {
        this.errorCode = errorCode;
    }
}
